import { createRouter, createWebHashHistory } from 'vue-router';
import IndexView from '@/views/index.vue';
import friendList from '@/components/friend/FriendList.vue'
import ChatList from '@/components/chat/chatList.vue'
import GroupList from '@/components/group/groupList.vue'
import GroupChatRoom from '@/components/group/groupDetail.vue'
import chatDetail from '@/components/chat/chatDetail.vue'
import FriendDetail from '@/components/friend/FriendDetail.vue'

const routes = [
  { 
    path: '/', 
    component: IndexView,
    children: [
      {
        path: 'chat',
        components: {
          module: ChatList,   // 中间模块栏内容
          content: chatDetail,  // 右侧聊天内容
        },
      },
      {
        path: 'friend',
        components: {
          module: friendList,  // 中间模块
          content: FriendDetail,  // 右侧模块
        },
      },
      {
        path: 'group',
        components: {
          module: GroupList,     // 中间区域显示群聊列表
          content: GroupChatRoom // 右侧区域显示群聊内容
        }
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes
});

export default router;
